/*PurchaseOrderInfoDetail  */
import request from "/@/utils/request";
import download from "/@/utils/download.ts";

const PurchaseOrderInfoDetailApi = {

    getPageData(data: any) {
        return request({
            url: "/purchaseOrderInfoDetail/pageData",
            method: "post",
            data,
        });
    },
        getPageDatas(data: any) {
        return request({
            url: "/supplierInfo/pageData",
            method: "post",
            data,
        });
    },
    getDetail(data: any) {
        return request({
            url: "/purchaseOrderInfoDetail/getDetail",
            method: "post",
            data,
        });
    },

    save: (data: any) => {
        return request({
            url: "purchaseOrderInfo/newSave",
            method: "post",
            data,
        });
    },
    // save: (data: any) => {
    //     return request({
    //         url: "/purchaseOrderInfo/save",
    //         method: "post",
    //         data,
    //     });
    // },
    del: (data: any) => {
        return request({
            url: "/purchaseOrderInfoDetail/del",
            method: "post",
            data,
        });
    },

    updateStatus: (data: any) => {
        return request({
            url: "/purchaseOrderInfoDetail/updateStatus",
            method: "post",
            data,
        });
    },
    pageDataXls:(_searchParam: any,_xlsTitle: any) => {
                const param = new URLSearchParams();
        param.append("_searchParam",JSON.stringify(_searchParam))
        param.append("_xlsTitle",JSON.stringify(_xlsTitle))
        return request({
            url: "/purchaseOrderInfoDetail/pageDataXls",
            method: "post",
            responseType: 'blob',
            headersType: 'application/json;charset=UTF-8',
           params:param,
        }).then((res)=> {
            download(res)
        });
    },
            pageDataXlss:(id: any) => {
            const param = new URLSearchParams();
            param.append("purchaseOrderInfoId", id)
            return request({
                url: "/purchaseOrderInfoDetail/pageDataXls",
                method: "post",
                responseType: 'blob',
                headersType: 'application/json;charset=UTF-8',
                params:param,
    
            }).then((res)=> {
                download(res)
            });
        },
    excelImport: (data:any)=>{
        return request({
            url: "/purchaseOrderInfoDetail/importDataXls",
            method: "post",
            headersType:'multipart/form-data',
            data,
        })
        
    },
       getSupplierTypeList(){
        return request({
            url: "/supplierInfoType/searchByType",
            method: "get",
        });
    },
       getCanciTypeList(){
        return request({
            url: "/sysDic/searchByType?dicClass=meal_times",

            method: "get",
         
        });
    },
    batchSave: (data:any)=>{
        return request({
            url: "/purchaseOrderInfoDetail/batchSave",
            headersType: 'application/json;charset=UTF-8',
            method: "post",
            data,
        })
    },
};
export default PurchaseOrderInfoDetailApi;
